from selenium import webdriver
from PIL import Image
import io
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
def get_val(img):

    # 使用Pillow处理图片
    image = Image.open(img)


    # 计算验证码图片的位置
    left = 1240
    top = 550
    bottom = 650
    right = 1530


    # 裁剪验证码图片
    image = image.crop((left, top, right, bottom))

    # 保存验证码图片
    image.save('val_code.png')

    return image

